package main

import "fmt"

func changeArray1(arr [5]int) {
	fmt.Println("【func|changeArray1】change before arr=", arr)
	arr[2] = 30
	fmt.Println("【func|changeArray1】change after arr=", arr)
}

func changeArray2(arr *[5]int) {
	fmt.Println("【func|changeArray2】change before arr=", arr)
	arr[2] = 30
	fmt.Println("【func|changeArray2】change after arr=", arr)
}

func changeArray3(s []int) {
	fmt.Println("【func|changeArray3】change before arr=", s)
	s[6] = 60
	fmt.Println("【func|changeArray3】change after arr=", s)
}

func main() {
	arr1 := [5]int{1, 2, 3, 4, 5}
	fmt.Println("【func|main|changeArray2】change before arr=", arr1)
	changeArray1(arr1)
	fmt.Println("【func|main|changeArray1】change after arr=", arr1)

	fmt.Println()

	fmt.Println("【func|main|changeArray2】change before arr=", arr1)
	changeArray2(&arr1)
	fmt.Println("【func|main|changeArray2】change after arr=", arr1)

	fmt.Println()

	s := []int{1, 2, 3, 4, 5, 6, 7, 8}
	fmt.Println("【func|main|changeArray3】change after s=", s)
	changeArray3(s)
	fmt.Println("【func|main|changeArray3】change after s=", s)

}
